*===================================================================*
*																	*
*                    Shaping Electoral Outcomes :                   *
*   Intra and Anti-systemic Violence in Indian Assembly Elections   *
*          Imke Harbers, Cécile Richetta, Enrike van Wingerden      *
*																	*
*===================================================================*

*===================================================================*
* 				REPLICATION FILE 3 : APPENDIX TABLES				*
*===================================================================*

* IF NECESSARY: INSTALL PACKAGES 
* ssc install estout
* ssc install collin

global dir "C:/setpath" 
use "$dir/data.dta"

xtset SHF_AC_ID Sequence

* APPENDIX A. Descriptive Statistics
	* Table 1. Descriptive Statistics of the Variables 
	sum Count2PIntr Count2PIl Count3 Count3Vl Count2PNB Count2PNBl ///
	state_ac_align Turnout_Percentage incumb_vote_shr ///
	Margin_Percentage lit ele urb rugg_std Constituency_Type

* APPENDIX B. Alternative Specifications of “Table 2. Results Fixed Effects Analysis, Dependent Variable: Turnout (%)”
* Table 1
	* Model 1	
	xtreg Turnout_Percentage i.Count2PIntr i.state_ac_align ///
	Margin_Percentage lit ele urb Turnout_lag WIDisCount2Intra, fe 
	eststo A
	* Model 2
	xtreg Turnout_Percentage i.Count3 i.state_ac_align ///
	Margin_Percentage lit ele urb Turnout_lag, fe 
	eststo B
	* Model 3
	xtreg Turnout_Percentage i.Count2PIntr i.Count3 i.state_ac_align ///
	Margin_Percentage lit ele urb Turnout_lag WIDisCount2Intra, fe 
	eststo C
	* Model 4
	xtreg Turnout_Percentage i.Count2PNBl i.state_ac_align ///
	Margin_Percentage lit ele urb Turnout_lag WIDisCount2PNB, ///
	fe vce(cluster ECI_DT_NAME)
	eststo D
	* Model 5 
	xtreg Turnout_Percentage i.Count2PNBl i.Count3Vl i.state_ac_align ///
	Margin_Percentage lit ele urb Turnout_lag WIDisCount2PNB, ///
	fe vce(cluster ECI_DT_NAME)
	eststo E
	* Export full table 
	esttab A B C D E ///
	using "$dir/appendixBtable1.rtf", /// 
	star(* 0.05 ** 0.01 *** 0.001) ///
	title("Table 1. Left: Binary independent variables; Right: Non-boycott violence as independent variable ") ///
	se scalars(ll) obslast ///
	replace

* APPENDIX C. 
* Tabble 1 
	* Model 1
	xtreg Count2PIntr i.state_ac_align Margin_Percentage lit ele ///
	urb rugg_std i.Constituency_Type, fe vce(cluster ECI_DT_NAME)
	eststo A
	* Model 2 
	xtreg Count3 i.state_ac_align Margin_Percentage lit ele ///
	urb rugg_std i.Constituency_Type, fe vce(cluster ECI_DT_NAME)
	eststo B
	* Export full table
	esttab A B ///
	using "$dir/appendixCtable1.rtf", /// 
	star(* 0.05 ** 0.01 *** 0.001) ///
	title("Table 1. Fixed effects model ") ///
	se scalars(ll) obslast ///
	replace
* Table 2
	* Model 1
	zip Count2NL i.state_ac_align Margin_Percentage lit ele ///
	urb rugg_std i.Constituency_Type i.State_Name, inflate(SHF_AC_ID) ///
	vce(robust)
	eststo A
	* Model 2
	zip Count2PL i.state_ac_align Margin_Percentage lit ele ///
	urb rugg_std i.Constituency_Type i.State_Name, inflate(SHF_AC_ID) ///
	vce(robust)
	eststo B
	* Model 3
	zip Count3PV i.state_ac_align Margin_Percentage lit ele ///
	urb rugg_std i.Constituency_Type i.State_Name, inflate(SHF_AC_ID) ///
	vce(robust)
	eststo C
	* Model 4
	zip Count2PNB i.state_ac_align Margin_Percentage lit ele ///
	urb rugg_std i.Constituency_Type i.State_Name, inflate(SHF_AC_ID) ///
	vce(robust)
	eststo D
	* Export full table
	esttab A B C D  ///
	using "$dir/appendixCtable2.rtf", /// 
	star(* 0.05 ** 0.01 *** 0.001) ///
	title("Table 2. Results ZIP Regression, Logit Inflation Model: Replications with alternative specifications of the dependent variables. ") ///
	se scalars(ll) obslast ///
	replace

* APPENDIX D. Alternative Specifications of “Table 4. Fixed Effects Analysis, Dependent Variable: Incumbent Vote Share (%).”
* Table 1
	* Model 1
	xtreg incumb_vote_shr i.Count2PIl i.state_ac_align ///
	Margin_Percentage lit ele urb Turnout_Percentage ///
	incumb_vote_lag, fe vce(cluster ECI_DT_NAME)
	eststo A
	* Model 2
	xtreg incumb_vote_shr i.Count2PIl##i.state_ac_align ///
	Margin_Percentage lit ele urb Turnout_Percentage ///
	incumb_vote_lag, fe vce(cluster ECI_DT_NAME)
	eststo B	
	* Model 3
	xtreg incumb_vote_shr i.Count2PNB i.state_ac_align ///
	Margin_Percentage lit ele urb Turnout_Percentage ///
	incumb_vote_lag, fe
	eststo D
	* Model 4
	xtreg incumb_vote_shr i.Count2PNB##i.state_ac_align ///
	Margin_Percentage lit ele urb Turnout_Percentage ///
	incumb_vote_lag, fe
	eststo E
	esttab A B C D ///
	using "$dir/appendixDtable1.rtf", /// 
	star(* 0.05 ** 0.01 *** 0.001) ///
	title("Table 1. Left: Intra-Systemic Violence (categorical operationalization); Right: Non-boycott violence. ") ///
	se scalars(ll) obslast ///
	replace

* APPENDIX E. Replications with Restricted Sample (missing observation on Incumbent Vote Share dropped)
preserve 
	keep if !missing(incumb_vote_shr)
	* Table 1
		* Model 1
		xtreg Turnout_Percentage i.Count2PIl i.state_ac_align ///
		Margin_Percentage lit ele urb Turnout_lag WIDisCount2PIntr, ///
		fe vce(cluster ECI_DT_NAME)
		eststo A
		* Model 2
		xtreg Turnout_Percentage i.Count3Vl i.state_ac_align ///
		Margin_Percentage lit ele urb Turnout_lag, ///
		fe vce(cluster ECI_DT_NAME)
		eststo B
		* Model 3
		xtreg Turnout_Percentage i.Count2PIl i.Count3Vl i.state_ac_align ///
		Margin_Percentage lit ele urb Turnout_lag WIDisCount2PIntr, ///
		fe vce(cluster ECI_DT_NAME)
		eststo C
		* Export full table 
		esttab A B C ///
		using "$dir/appendixETable1.rtf", /// 
		star(* 0.05 ** 0.01 *** 0.001) ///
		title("Table 1. Replication Results Fixed Effects Analysis, Dependent Variable: Turnout (%). Restricted sample.") ///
		se scalars(ll) obslast ///
		replace
	* Table 2
		* Model 1
		zip Count2PIntr i.state_ac_align Margin_Percentage lit ele ///
		urb rugg_std i.Constituency_Type i.State_Name, inflate(SHF_AC_ID) ///
		vce(robust)
		eststo A
		* Model 2
		zip Count3PV i.state_ac_align Margin_Percentage lit ele ///
		urb rugg_std i.Constituency_Type i.State_Name, inflate(SHF_AC_ID) ///
		vce(robust)
		eststo B
		* Export full table 
		esttab A B ///
		using "$dir/appendixETable2.rtf", /// 
		star(* 0.05 ** 0.01 *** 0.001) ///
		title("Table 2. Replication Results Zero-Inflated Poisson (ZIP) Regression, Logit Inflation Model. Restricted Sample.") ///
		se scalars(ll N_zero k ic) obslast ///
		replace
restore 

* APPENDIX F. Replications with Full Sample (missing observation on Incumbent Vote Share set to 0)
* Table 1. 
preserve
	gen nincumb_shr = incumb_vote_shr
	replace nincumb_shr = 0 if incumb_vote_shr==.
	* Model 1
	xtreg nincumb_shr i.Count2PIntr i.state_ac_align ///
	Margin_Percentage lit ele urb Turnout_Percentage ///
	incumb_vote_lag, fe vce(cluster ECI_DT_NAME)
	eststo A
	* Model 2
	xtreg nincumb_shr i.Count2PIntr##i.state_ac_align ///
	Margin_Percentage lit ele urb Turnout_Percentage ///
	incumb_vote_lag, fe vce(cluster ECI_DT_NAME)
	eststo B
	* Export full table 
	esttab A B ///
	using "$dir/appendixFtable1.rtf", /// 
	star(* 0.05 ** 0.01 *** 0.001) ///
	title("Table 1. Replication Results Fixed Effects Analysis, Dependent Variable: Incumbent Vote Share (%). Full Sample.") ///
	se scalars(ll) obslast ///
	replace
restore 

